package com.ftu.study.pattern.command;

public class RemoteLoader2 {
    public static void main(String[] args) {
        RemoteControl remoteControl = new RemoteControl();
        
        Light livingRoomLight = new Light("Living Room");
        Light kitchenLight = new Light("Kitchen");
        
        LightOnCommand livingRoomLightOn = new LightOnCommand(livingRoomLight);
        LightOnCommand KitchenLightOn = new LightOnCommand(kitchenLight);
        LightOffCommand livingRoomLightOff = new LightOffCommand(livingRoomLight);
        LightOffCommand KitchenLightOff = new LightOffCommand(kitchenLight);
        
        Command[] partyOn = {livingRoomLightOn, KitchenLightOn};
        Command[] partyOff = {livingRoomLightOff, KitchenLightOff};
        
        remoteControl.setCommand(0, livingRoomLightOn, livingRoomLightOff);
        remoteControl.setCommand(1, KitchenLightOn, KitchenLightOff);
        remoteControl.setCommand(6, new MacroCommand(partyOn), new MacroCommand(partyOff));
        
        System.out.println(remoteControl.toString());
        
        remoteControl.onButtonWasPushed(0);
        remoteControl.offButtonWasPushed(0);
        remoteControl.undoButtonWasPushed();
        remoteControl.onButtonWasPushed(1);
        remoteControl.offButtonWasPushed(1);
        remoteControl.undoButtonWasPushed();
        
        System.out.println("---party mode----");
        remoteControl.onButtonWasPushed(6);
        System.out.println("--undo--");
        remoteControl.undoButtonWasPushed();
//        remoteControl.offButtonWasPushed(6);
    }
}
